<?php
namespace app\admin\model;
use think\Model;
class Resource extends Model
{
    public function SaveResource($resource_info)
    {
        $resource = new Resource;
        if (!isset($resource_info['id'])){
            $resource->resource = $resource_info['resource'];
            $resource->path = $resource_info['path'];
            $resource->created = time();
            $resource->save();
            $resource_id =$resource->id;
            return $resource_id;
        }
        $list = [
            'resource' => $resource_info['resource'],
            'path' => $resource_info['path'],
            'created' => time()
        ];
        return $resource->save($list,['id' => $resource_info['id']]);
    }
    
}